package org.intellij.plugins.junit4.action;

import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import org.apache.log4j.Logger;
import org.intellij.plugins.junit4.JavaFile;

/**
 * Toggles test and production clases.
 *
 * @author Justin Tomich
 */
public class ToggleTestProductionAction extends AnAction
{
    public void actionPerformed(AnActionEvent anActionEvent)
    {
        ActionEvent event = new ActionEvent(anActionEvent);

        JavaFile file = event.getSelectedJavaFile();
        if (file == null) return;

        JavaFile toggled = file.toggleProductionTestFiles();
        if (toggled == null) return;

        toggled.openInEditor();
    }
}
